from collections import OrderedDict
from rest_framework.response import Response
from rest_framework.pagination import PageNumberPagination


class MyPageNumberPagination(PageNumberPagination):
    page_query_param = 'page'
    page_size_query_param = 'pagesize'

    def get_paginated_response(self, data):
        return Response(OrderedDict([
            ('lists', data),
            ('page', self.page.number),
            ('pages', self.page.paginator.num_pages)
        ]))